pub mod c;
pub mod cbase;
pub mod np;
pub mod p;
pub mod u;
pub mod xbar;

type VecF = Vec<f64>;
type VecI = Vec<i64>;
type VecFs = Vec<VecF>;

use super::{
    err, err_value, json, ok, throw_err, Base, Client, ECode, MapSv, Resp, VBase, VMap, Value,
};
use cbase::CBase;

pub async fn doit(para: &Value, cmd: &str, client: &Client) -> Resp {
    match cmd {
        "p" => {
            let v = p::P;
            v.do_cmd(para, &client).await
        }
        "np" => {
            let v = np::Np;
            v.do_cmd(para, &client).await
        }
        "c" => {
            let v = c::C;
            v.do_cmd(para, &client).await
        }
        "u" => {
            let v = u::U;
            v.do_cmd(para, &client).await
        }
        "xbar" | "xbarr" => {
            let v = xbar::Xbar;
            v.do_cmd(cmd, para, &client).await
        }
        _ => throw_err!(ECode::NoServe, "no cmd"),
    }
}
